/* Copyright (C) 2015-2016 HangZhou Zenzet Technology Co., Ltd.
 * All right reserved

 * File:crypto/locketrsa.h
 * Author:guojianchuan/max
 * Date:2016-06-06
 
 */

#ifndef _LOCKET_RSA_H_
#define _LOCKET_RSA_H_

#ifdef __cplusplus
extern "C" {
#endif

/* Declare : Macro/Struct/Enum/Union */

/**
* @Struct: CIPHER_RSA_S
* @Author: guojianchuan/max
* @Date: 2016-06-02
* @Description: RSA结构
*/
typedef struct tagRSA
{
    /* 输入 */
    unsigned char *pucInput;

    /* 输入长度 */
    int iInputLen;

    /* 输入编码格式 hex:0 base64:1 binary:2 */
    int iInputEncode;

    /* 输出(若是1024-RSA，则要求buffer大小至少128；若是2048-RSA，则要求buffer大小至少256 */
    unsigned char *pucOutput;

    /* 输出编码格式 hex:0 base64:1 binary:2 */
    int iOutputEncode;

    /* 输出长度 */
    int iOutputLen;

    /* 公钥/密钥 加密时设置为公钥，解密时设置为私钥 */
    unsigned char *pucKey;
}CIPHER_RSA_S;

/* Declare: Function */
int LOCKET_CIPHER_RSAEncrypt (INOUT CIPHER_RSA_S *pstRSA);  //(PADDING: PKCS-OAEP)
int LOCKET_CIPHER_RSADecrypt (INOUT CIPHER_RSA_S *pstRSA);  //(PADDING: PKCS-OAEP)

#ifdef __cplusplus
}
#endif

#endif  /* _LOCKET_RSA_H_ */
